import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    role: null as number | null,
    isLoggedIn: false
  }),
  
  actions: {
    login(role: number) {
      this.role = role
      this.isLoggedIn = true
      localStorage.setItem('userRole', role.toString())
    },
    
    logout() {
      this.role = null
      this.isLoggedIn = false
      localStorage.removeItem('userRole')
    }
  }
}) 